﻿<script id="contactsListFilterTmpl" type="text/x-jquery-tmpl">
    <div id="contactsFilterContainer">
        <div id="contactsAdvansedFilter"></div>
    </div>
    <ul id="contactsHeaderMenu" class="clearFix contentMenu contentMenuDisplayAll">
        <li class="menuAction menuActionSelectAll menuActionSelectLonely">
            <div class="menuActionSelect">
                <input type="checkbox" id="mainSelectAll" title="${ASC.CRM.Resources.CRMCommonResource.SelectAll}" onclick="ASC.CRM.ListContactView.selectAll(this);" />
            </div>
        </li>
        {{if IsCRMAdmin === true}}
        <li class="menuAction menuActionSendEmail" title="${ASC.CRM.Resources.CRMCommonResource.SendEmail}">
            <span>${ASC.CRM.Resources.CRMCommonResource.SendEmail}</span>
            <div class="down_arrow"></div>
        </li>
        {{/if}}
        <li class="menuAction menuActionAddTag" title="${ASC.CRM.Resources.CRMCommonResource.AddNewTag}">
            <span>${ASC.CRM.Resources.CRMCommonResource.AddNewTag}</span>
            <div class="down_arrow"></div>
        </li>
        <li class="menuAction menuActionAddTask" title="${ASC.CRM.Resources.CRMTaskResource.AddNewTaskButtonText}">
            <span>${ASC.CRM.Resources.CRMTaskResource.AddNewTaskButtonText}</span>
        </li>
        <li class="menuAction menuActionDelete" title="${ASC.CRM.Resources.CRMCommonResource.Delete}">
            <span>${ASC.CRM.Resources.CRMCommonResource.Delete}</span>
        </li>
        <li class="menu-action-simple-pagenav">
        </li>
        <li class="menu-action-checked-count">
            <span></span>
            <a class="linkDescribe baseLinkAction" style="margin-left:10px;" onclick="ASC.CRM.ListContactView.deselectAll();">
                ${ASC.CRM.Resources.CRMCommonResource.DeselectAll}
            </a>
        </li>
        <li class="menu-action-on-top">
            <a class="on-top-link" onclick="javascript:window.scrollTo(0, 0) || document.querySelector('.mainPageContent').scrollTo(0, 0);">
                ${ASC.CRM.Resources.CRMCommonResource.OnTop}
            </a>
        </li>
    </ul>
    <div class="header-menu-spacer">&nbsp;</div>
</script>

<script id="contactsListBaseTmpl" type="text/x-jquery-tmpl">
    <div id="mainContactList">
        <div class="clearFix">
            <div id="companyListBox" style="display: none">
                <table id="companyTable" class="table-list padding4" cellpadding="0" cellspacing="0">
                    <colgroup>
                        <col style="width: 26px;"/>
                        <col style="width: 40px;"/>
                        <col/>
                        <col style="width: 200px;"/>
                        <col style="width: 200px;"/>
                        <col style="width: 200px;"/>
                        <col style="width: 40px;"/>
                    </colgroup>
                    <tbody>
                    </tbody>
                </table>
            </div>
        </div>
    </div>

    <div id="permissionsContactsPanelInnerHtml" class="display-none">
        {{if IsCRMAdmin !== true}}
        <div style="margin-top:10px">
            <b>${ASC.CRM.Resources.CRMCommonResource.AccessRightsLimit}</b>
        </div>
        {{/if}}
    </div>


    {{if IsCRMAdmin === true}}
    <div id="sendEmailDialog" class="studio-action-panel group-actions">
        <ul class="dropdown-content">
            <li>
                <a class="dropdown-item" onclick="ASC.CRM.ListContactView.showCreateLinkPanel()">
                    ${ASC.CRM.Resources.CRMSettingResource.ExternalClient}
                </a>
            </li>
            <li>
                <a class="dropdown-item" onclick="ASC.CRM.ListContactView.showSenderPage()">
                    ${ASC.CRM.Resources.smtpQuotas}
                </a>
            </li>
        </ul>
    </div>
    {{/if}}

    <div id="addTagDialog" class="studio-action-panel group-actions addTagDialog">
        <ul class="dropdown-content mobile-overflow"></ul>
        <div class="h_line">&nbsp;</div>
        <div style="padding: 0 12px;">
            <div style="margin-bottom: 5px;" >${ASC.CRM.Resources.CRMCommonResource.CreateNewTag}:</div>
            <input type="text" maxlength="50" class="textEdit" />
            <a onclick="ASC.CRM.ListContactView.addNewTag();" class="button blue" id="addThisTag">
                ${ASC.CRM.Resources.CRMCommonResource.OK}
            </a>
        </div>
    </div>

    <div id="contactActionMenu" class="studio-action-panel">
        <ul class="dropdown-content">
            <li><a class="showProfileLink dropdown-item with-icon user">${ASC.CRM.Resources.CRMContactResource.ShowContactProfile}</a></li>
            <li><a class="showProfileLinkNewTab dropdown-item with-icon new-tab">${ASC.CRM.Resources.CRMContactResource.ShowContactProfileNewTab}</a></li>
            <li class="dropdown-item-seporator"></li>
            <li><a class="addPhoneLink dropdown-item with-icon phone">${ASC.CRM.Resources.CRMJSResource.AddNewPhone}</a></li>
            <li><a class="addEmailLink dropdown-item with-icon add-email">${ASC.CRM.Resources.CRMJSResource.AddNewEmail}</a></li>
            <li class="dropdown-item-seporator"></li>
            <li><a class="makeVoIPCallLink dropdown-item with-icon call">${ASC.CRM.Resources.CRMJSResource.MakeVoIPCall}</a></li>
            <li><a class="sendEmailLink dropdown-item with-icon email" target="_blank">${ASC.CRM.Resources.CRMContactResource.WriteEmail}</a></li>
            <li><a class="addTaskLink dropdown-item with-icon new-task">${ASC.CRM.Resources.CRMTaskResource.AddNewTask}</a></li>
            <li><a class="addDealLink dropdown-item with-icon new-opportunity">${ASC.CRM.Resources.CRMDealResource.CreateNewDeal}</a></li>
            <li><a class="addCaseLink dropdown-item with-icon case">${ASC.CRM.Resources.CRMCasesResource.CreateNewCase}</a></li>
            <li class="dropdown-item-seporator"></li>
            <li><a class="editContactLink dropdown-item with-icon edit">${ASC.CRM.Resources.CRMContactResource.EditContact}</a></li>
            <li><a class="deleteContactLink dropdown-item with-icon delete">${ASC.CRM.Resources.CRMContactResource.DeleteContact}</a></li>
        </ul>
    </div>

</script>

<script id="contactsListPagingTmpl" type="text/x-jquery-tmpl">
    <table id="tableForContactNavigation" class="crm-navigationPanel" cellpadding="0" cellspacing="0" border="0">
        <tbody>
            <tr>
                <td>
                    <div id="divForContactPager">
                    </div>
                </td>
                <td style="text-align:right;">
                    <span class="gray-text">${ASC.CRM.Resources.CRMContactResource.TotalContacts}:&nbsp;</span>
                    <span class="gray-text" id="totalContactsOnPage"></span>
                    <span class="page-nav-info">
                        <span class="gray-text">${ASC.CRM.Resources.CRMCommonResource.ShowOnPage}:&nbsp;</span>
                        <select class="top-align">
                            <option value="25">25</option>
                            <option value="50">50</option>
                            <option value="75">75</option>
                            <option value="100">100</option>
                        </select>
                    </span>
                </td>
            </tr>
        </tbody>
    </table>
</script>

<script id="contactListTmpl" type="text/x-jquery-tmpl">
    <tbody>
        {{tmpl(contacts) "contactTmpl"}}
    </tbody>
</script>

<script id="contactTmpl" type="text/x-jquery-tmpl">
    <tr id="contactItem_${id}" class="with-entity-menu">
        <td style="padding-left: 6px;">
            <input type="checkbox" id="check_contact_${id}" onclick="ASC.CRM.ListContactView.selectItem(this);" style="margin-left: 2px;" {{if isChecked == true}}checked="checked"{{/if}} />
            <div id="loaderImg_${id}" class="loader-middle baseList_loaderImg"></div>
        </td>


        <td>
            <div class="contactItemPhotoImgContainer{{if isShared === true}} sharedContact{{/if}}">
                {{if isCompany == true}}
                <img class="contactItemPhotoImg" src="${ASC.CRM.Data.SmallSizePhotoCompany}" alt="${displayName}" title="${displayName}" onload="ASC.CRM.Common.loadContactFoto(jq(this), jq(this).next(), '${smallFotoUrl}');" />
                {{else}}
                <img class="contactItemPhotoImg" src="${ASC.CRM.Data.SmallSizePhoto}" alt="${displayName}" title="${displayName}" onload="ASC.CRM.Common.loadContactFoto(jq(this), jq(this).next(), '${smallFotoUrl}');" />
                {{/if}}
                <img class="contactItemPhotoImg" style="display:none;" alt="${displayName}" title="${displayName}"/>
            </div>
        </td>

        <td>
            <div class="contactTitle">
                <a class="linkHeaderMedium" href="Default.aspx?id=${id}">
                    ${displayName}
                </a>
            </div>
            {{if isCompany == false && company != null}}
                <div class="contactTitle">
                    ${ASC.CRM.Resources.CRMContactResource.Company}:&nbsp;
                    <a href="Default.aspx?id=${company.id}" data-id="${company.id}" id="contact_${id}_company_${company.id}" class="linkMedium crm-companyInfoCardLink">
                        ${company.displayName}
                    </a>
                </div>
            {{/if}}
        </td>

        <td>
            <div class="primaryDataContainer">
                <input type="text" id="addPrimaryPhone_${id}" class="textEdit addPrimaryDataInput" autocomplete="off" maxlength="100"/>
            {{if primaryPhone != null}}
                <span class="primaryPhone {{if ASC.VoipNavigationItem && ASC.VoipNavigationItem.isInit}}link{{/if}}" title="${primaryPhone.data}">${primaryPhone.data}</span>
            {{/if}}
            </div>
        </td>

        <td>
            <div class="primaryDataContainer">
                <input type="text" id="addPrimaryEmail_${id}" class="textEdit addPrimaryDataInput" autocomplete="off" maxlength="100"/>
            {{if primaryEmail != null}}
                <a class="primaryEmail linkMedium" title="${primaryEmail.data}" href="${primaryEmail.emailHref}" target="_blank">
                    ${primaryEmail.data}
                </a>
            {{/if}}
            </div>
        </td>

        <td>
            {{if nearTask != null}}
                <span id="taskTitle_${nearTask.id}" class="header-base-small nearestTask"
                    ttl_label="${ASC.CRM.Resources.CRMCommonResource.Title}" ttl_value="${nearTask.title}"
                    dscr_label="${ASC.CRM.Resources.CRMCommonResource.Description}" dscr_value="${nearTask.description}"
                    resp_label="${ASC.CRM.Resources.CRMCommonResource.Responsible}" resp_value="${nearTask.responsible.displayName}">
                        ${nearTask.category.title} ${nearTask.deadLineString}
                </span>
            {{/if}}
        </td>
        <td>
            <div id="contactMenu_${id}" class="entity-menu" title="${ASC.CRM.Resources.CRMCommonResource.Actions}"></div>
        </td>
    </tr>
</script>

<script id="collectionContainerTmpl" type="text/x-jquery-tmpl">
    <tr>
        <td class="describe-text" style="white-space:nowrap;">${Type}:</td>
        <td></td>
        <td class="collectionItemsTD"></td>
    </tr>
</script>

<script id="collectionTmpl" type="text/x-jquery-tmpl">
    {{if infoType == 0}}
        <div class="collectionItem">
            {{if isPrimary == true}}
            <a href="tel:${data}" class="linkMedium">${data}</a>
            {{else}}
            <span>${data}</span>
            {{/if}}
            &nbsp;<span class="text-medium-describe">(${categoryName})</span>
        </div>

    {{else infoType == 1}}
        <div class="collectionItem">
            <a href="mailto:${data}" class="linkMedium">${data}</a>
            &nbsp;<span class="text-medium-describe">(${categoryName})</span>
            {{if isPrimary == true}}<a class="linkDescribe baseLinkAction writeEmail" data-email="${data}">${ASC.CRM.Resources.CRMContactResource.WriteEmail}</a>{{/if}}
        </div>

    {{else infoType == 3 || infoType == 15 || infoType == 16}}
        <div class="collectionItem">
            <span>${data}</span>
            &nbsp;<span class="text-medium-describe">(${categoryName})</span>
        </div>

    {{else infoType == 10  || infoType == 12 || infoType == 13}}
        <div class="collectionItem">
            <a href="mailto:${data}" class="linkMedium">${data}</a>
            &nbsp;<span class="text-medium-describe">(${categoryName})</span>
        </div>
    {{else infoType == 2 || infoType == 4 || infoType == 5 || infoType == 6 ||infoType == 8 ||infoType == 9 || infoType == 11 || infoType == 14 || infoType == 17}}
        <div class="collectionItem">
            <a href="${href}" target="_blank" class="linkMedium">${data}</a>
            &nbsp;<span class="text-medium-describe">(${categoryName})</span>
        </div>

    {{else infoType == 7}}
        <div class="collectionItem">
            {{html data}}
            &nbsp;<span class="text-medium-describe">(${categoryName})</span><br/>
            <a style="text-decoration: underline;" href="${href}" target="_blank" class="linkMedium">
                ${ASC.CRM.Resources.CRMContactResource.ShowOnMap}
            </a>
        </div>
    {{/if}}
</script>

<script id="projectSelectorOptionTmpl" type="text/x-jquery-tmpl">
    <option value="${id}">${title}</option>
</script>

<script id="projectSelectorItemTmpl" type="text/x-jquery-tmpl">
   <li data-id="${id}"><div class="dropdown-item">${title}</div></li>
</script>

<script id="listContactsToMergeTmpl" type="text/x-jquery-tmpl">
    {{each contacts}}
    <li>
        <input type="radio" name="contactToMerge" value="${id}" />
        <span>${displayName}</span>
    </li>
    {{/each}}
    <li>
        <input type="radio" name="contactToMerge" value="0"{{if count == 0}} style="display: none;"{{/if}} />
        <div class="contactToMergeSelectorContainer"{{if count > 0}} style="margin-left: 0;"{{/if}}>
        </div>
        <input type="hidden" name="selectedContactToMergeID" value="0" />
    </li>
</script>
